<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('文件列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
	<div class="row">
		<div class="col-sm-12 search-collapse">
			<form id="post-form">
				<div class="select-list">
					<ul>
						<li>
							项目名称：<input type="text" name="gitee"/>
						</li>
						<li>
							项目地址：<input type="text" name="address"/>
						</li>
						</li>
						<li>
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</li>
					</ul>
				</div>
			</form>
		</div>

		<div class="btn-group-sm" id="toolbar" role="group">
			<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:gitee:add">
				<i class="fa fa-plus"></i> 上传
			</a>
		</div>

		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table"></table>
		</div>
	</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
	var editFlag = [[${@permission.hasPermi('system:gitee:edit')}]];
	var removeFlag = [[${@permission.hasPermi('system:gitee:remove')}]];
	var datas = [[${@dict.getType('sys_normal_disable')}]];
	var prefix = ctx + "system/file";

	$(function() {
		console.log(removeFlag)
		var options = {
			url: prefix + "/getList",
			createUrl: prefix + "/upload",
			updateUrl: prefix + "/edit/{download}",
			removeUrl: prefix + "/remove/{id}",
			exportUrl: prefix + "/export",
			downloadLocalUrl: prefix + "/downloadLocal/{id}",
			sortName: "file",
			modalName: "file",
			columns: [{
				checkbox: true
			},
				{
					field: 'fileId',
					title: 'fileId'
				},
				{
					field: 'fileName',
					title: '文件名',
					sortable: true
				},
				{
					field: 'startTime',
					title: '导入时间',
					sortable: true
				},
				{
					field: 'download',
					title: '下载链接',
					sortable: true,
					view: false
				},
				{
					title: '操作',
					align: 'center',
					formatter: function(value, row, index) {
						var actions = [];
						console.log(row.id);
						actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.downloadLocal(\'' + row.fileId + '\')"><i class="fa fa-download"></i>下载</a>');
						return actions.join('');
					}
				}]
		};
		$.table.init(options);
	});


</script>
</body>
</html>